cmake_minimum_required( VERSION 2.8 )
project ( Linn )

include_directories(
    /usr/include
    include
)

find_package(BISON)
find_package(FLEX)

set( LIBRARY_OUTPUT_PATH ${Linn_BINARY_DIR}/lib )
set( EXECUTABLE_OUTPUT_PATH ${Linn_BINARY_DIR}/bin )

BISON_TARGET(ExpressionParser src/syntax/expparser.y src/turtle/exp.tab.cpp COMPILE_FLAGS "-p exp")
FLEX_TARGET(ExpressionTokens src/syntax/exptokens.l src/turtle/lex.exp.c COMPILE_FLAGS "-P exp")
ADD_FLEX_BISON_DEPENDENCY(ExpressionTokens ExpressionParser)

BISON_TARGET(RepetitionParser src/syntax/repparser.y src/turtle/rep.tab.cpp COMPILE_FLAGS "-p rep")
FLEX_TARGET(RepetitionTokens src/syntax/reptokens.l src/turtle/lex.rep.c COMPILE_FLAGS "-P rep")
ADD_FLEX_BISON_DEPENDENCY(RepetitionTokens RepetitionParser)

add_library ( Linn SHARED
	src/turtle/RoutePlanner
	
	src/turtle/Turtle
	src/turtle/TurtleState
	
	${BISON_RepetitionParser_OUTPUTS}
  	${FLEX_RepetitionTokens_OUTPUTS}
  	${BISON_ExpressionParser_OUTPUTS}
  	${FLEX_ExpressionTokens_OUTPUTS}
)

add_executable( console
	demo/console/console
)

target_link_libraries( console
	Linn
)

add_executable( ogl
	demo/ogl/ogl
	demo/ogl/VerticesWatcher
)

target_link_libraries( ogl
	Linn
	glut
	GLU
)